package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MdDeptResourceService;
import com.qidian.mes.md.vo.MdDeptResourceVO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-11 16:15
 **/

@RestController
@RequestMapping("/dept")
@CrossOrigin
public class MdDeptResourceController {
    @Autowired
    MdDeptResourceService mdDeptResourceService;

    //添加
    @PostMapping("/add")
    public QdResult addDeptResources(@RequestBody MdDeptResourceVO mdDeptResourceVO){
        return mdDeptResourceService.insertDeptResources(mdDeptResourceVO);
    }


    //修改
    @PutMapping("/update")
    public QdResult updateDeptResources(@RequestBody MdDeptResourceVO mdDeptResourceVO){
        return mdDeptResourceService.updateDeptResources(mdDeptResourceVO);
    }

    //删除
    @DeleteMapping("/delete")
    public QdResult deleteDeptResources(@RequestBody MdDeptResourceVO mdDeptResourceVO){
        return mdDeptResourceService.deleteDeptResources(mdDeptResourceVO);
    }

    //根据工作站ID去查询
    @GetMapping("/work")
    public QdResult getDeptResources(@RequestParam Integer idWork){
        return mdDeptResourceService.getDeptResources(idWork);
    }
    //查询所有内容
    @GetMapping("")
    public QdResult getDeptsByName(@RequestParam String deptName){
        return mdDeptResourceService.getDeptsByName(deptName);
    }
}
